/**
 * @author 小也
 * @create 2021/4/3 8:09
 */
public class BinarySearch {
    public static void search(int[] arr,int left,int right,int x) {
        if (x < arr[left] || x > arr[right]){
            System.out.println("x不存在");
            return;
        }
        int mid = left + (right - left)/2;
        if (x == arr[mid]){
            System.out.println("x存在");
        }

        if (x < arr[mid]){
            search(arr,left,mid - 1,x);
        }
        if (x > arr[mid]){
            search(arr,mid + 1,right,x);
        }
    }
}
